﻿using System;
using System.Collections.Generic;
using System.Text;

using H2.NET.Data.Common;
using H2.NET.Data.Common.Mappings;
using H2.NET.Data.Common.Validates;

namespace H2.NET.Business
{
    [Table]
    [Serializable]
    public partial class mdc_Bom_MTO_Fini : DataObject
    {
        [ID]
        [DID]
        public string ID { get { return _ID; } set { _ID = value; EntityState.FieldChange("ID"); } }
        private string _ID;
        public static FieldInfo id = new FieldInfo("mdc_Bom_MTO_Fini", "ID");

        [Column]
        public string Process { get { return _Process; } set { _Process = value; EntityState.FieldChange("Process"); } }
        private string _Process;
        public static FieldInfo process = new FieldInfo("mdc_Bom_MTO_Fini", "Process");

        [Column]
        public int Incident { get { return _Incident; } set { _Incident = value; EntityState.FieldChange("Incident"); } }
        private int _Incident;
        public static FieldInfo incident = new FieldInfo("mdc_Bom_MTO_Fini", "Incident");

        [Column]
        public string UserName { get { return _UserName; } set { _UserName = value; EntityState.FieldChange("UserName"); } }
        private string _UserName;
        public static FieldInfo userName = new FieldInfo("mdc_Bom_MTO_Fini", "UserName");

        [Column]
        public int No { get { return _No; } set { _No = value; EntityState.FieldChange("No"); } }
        private int _No;
        public static FieldInfo no = new FieldInfo("mdc_Bom_MTO_Fini", "No");

        [Column]
        public string Product_Line { get { return _Product_Line; } set { _Product_Line = value; EntityState.FieldChange("Product_Line"); } }
        private string _Product_Line;
        public static FieldInfo product_Line = new FieldInfo("mdc_Bom_MTO_Fini", "Product_Line");

        [Column]
        public string SKU_Code { get { return _SKU_Code; } set { _SKU_Code = value; EntityState.FieldChange("SKU_Code"); } }
        private string _SKU_Code;
        public static FieldInfo sKU_Code = new FieldInfo("mdc_Bom_MTO_Fini", "SKU_Code");

        [Column]
        public string SKU_Code_Q { get { return _SKU_Code_Q; } set { _SKU_Code_Q = value; EntityState.FieldChange("SKU_Code_Q"); } }
        private string _SKU_Code_Q;
        public static FieldInfo sKU_Code_Q = new FieldInfo("mdc_Bom_MTO_Fini", "SKU_Code_Q");

        [Column]
        public string Plant { get { return _Plant; } set { _Plant = value; EntityState.FieldChange("Plant"); } }
        private string _Plant;
        public static FieldInfo plant = new FieldInfo("mdc_Bom_MTO_Fini", "Plant");

        [Column]
        public string Sefi_Code { get { return _Sefi_Code; } set { _Sefi_Code = value; EntityState.FieldChange("Sefi_Code"); } }
        private string _Sefi_Code;
        public static FieldInfo sefi_Code = new FieldInfo("mdc_Bom_MTO_Fini", "Sefi_Code");

        [Column]
        public string Product { get { return _Product; } set { _Product = value; EntityState.FieldChange("Product"); } } private string _Product; public static FieldInfo product = new FieldInfo("mdc_Bom_MTO_Fini", "Product");
        [Column]
        public string Product_Q { get { return _Product_Q; } set { _Product_Q = value; EntityState.FieldChange("Product_Q"); } } private string _Product_Q; public static FieldInfo product_Q = new FieldInfo("mdc_Bom_MTO_Fini", "Product_Q");

 

        [Column]
        public string TW_Old_Material_Code { get { return _TW_Old_Material_Code; } set { _TW_Old_Material_Code = value; EntityState.FieldChange("TW_Old_Material_Code"); } }
        private string _TW_Old_Material_Code;
        public static FieldInfo tW_Old_Material_Code = new FieldInfo("mdc_Bom_MTO_Fini", "TW_Old_Material_Code");

        [Column]
        public string TW_Fini_SAP_Code { get { return _TW_Fini_SAP_Code; } set { _TW_Fini_SAP_Code = value; EntityState.FieldChange("TW_Fini_SAP_Code"); } }
        private string _TW_Fini_SAP_Code;
        public static FieldInfo tW_Fini_SAP_Code = new FieldInfo("mdc_Bom_MTO_Fini", "TW_Fini_SAP_Code");

        [Column]
        public string TW_Plant { get { return _TW_Plant; } set { _TW_Plant = value; EntityState.FieldChange("TW_Plant"); } }
        private string _TW_Plant;
        public static FieldInfo tW_Plant = new FieldInfo("mdc_Bom_MTO_Fini", "TW_Plant");

        [Column]
        public string TW_BoM_Usage { get { return _TW_BoM_Usage; } set { _TW_BoM_Usage = value; EntityState.FieldChange("TW_BoM_Usage"); } }
        private string _TW_BoM_Usage;
        public static FieldInfo tW_BoM_Usage = new FieldInfo("mdc_Bom_MTO_Fini", "TW_BoM_Usage");

        [Column]
        public string TW_BoM_status { get { return _TW_BoM_status; } set { _TW_BoM_status = value; EntityState.FieldChange("TW_BoM_status"); } }
        private string _TW_BoM_status;
        public static FieldInfo tW_BoM_status = new FieldInfo("mdc_Bom_MTO_Fini", "TW_BoM_status");

        [Column]
        public string TW_Base_quantity { get { return _TW_Base_quantity; } set { _TW_Base_quantity = value; EntityState.FieldChange("TW_Base_quantity"); } }
        private string _TW_Base_quantity;
        public static FieldInfo tW_Base_quantity = new FieldInfo("mdc_Bom_MTO_Fini", "TW_Base_quantity");

        [Column]
        public string TW_Top_Sefi { get { return _TW_Top_Sefi; } set { _TW_Top_Sefi = value; EntityState.FieldChange("TW_Top_Sefi"); } }
        private string _TW_Top_Sefi;
        public static FieldInfo tW_Top_Sefi = new FieldInfo("mdc_Bom_MTO_Fini", "TW_Top_Sefi");


        [Column]
        public string TW_Alt_text { get { return _TW_Alt_text; } set { _TW_Alt_text = value; EntityState.FieldChange("TW_Alt_text"); } }
        private string _TW_Alt_text;
        public static FieldInfo tW_Alt_text = new FieldInfo("mdc_Bom_MTO_Fini", "TW_Alt_text");

        [Column]
        public string TW_Alternative_Bom { get { return _TW_Alternative_Bom; } set { _TW_Alternative_Bom = value; EntityState.FieldChange("TW_Alternative_Bom"); } }
        private string _TW_Alternative_Bom;
        public static FieldInfo tW_Alternative_Bom = new FieldInfo("mdc_Bom_MTO_Fini", "TW_Alternative_Bom");

        [Column]
        public string TW_Lot_Size { get { return _TW_Lot_Size; } set { _TW_Lot_Size = value; EntityState.FieldChange("TW_Lot_Size"); } }
        private string _TW_Lot_Size;
        public static FieldInfo tW_Lot_Size = new FieldInfo("mdc_Bom_MTO_Fini", "TW_Lot_Size");

        [Column]
        public string Packager { get { return _Packager; } set { _Packager = value; EntityState.FieldChange("Packager"); } }
        private string _Packager;
        public static FieldInfo packager = new FieldInfo("mdc_Bom_MTO_Fini", "Packager");

        [Column]
        public string Packager_Q { get { return _Packager_Q; } set { _Packager_Q = value; EntityState.FieldChange("Packager_Q"); } }
        private string _Packager_Q;
        public static FieldInfo packager_Q = new FieldInfo("mdc_Bom_MTO_Fini", "Packager_Q");

        [Column]
        public string Carton { get { return _Carton; } set { _Carton = value; EntityState.FieldChange("Carton"); } }
        private string _Carton;
        public static FieldInfo carton = new FieldInfo("mdc_Bom_MTO_Fini", "Carton");

        [Column]
        public string Carton_Q { get { return _Carton_Q; } set { _Carton_Q = value; EntityState.FieldChange("Carton_Q"); } }
        private string _Carton_Q;
        public static FieldInfo carton_Q = new FieldInfo("mdc_Bom_MTO_Fini", "Carton_Q");

        [Column]
        public string Carton_Cover { get { return _Carton_Cover; } set { _Carton_Cover = value; EntityState.FieldChange("Carton_Cover"); } }
        private string _Carton_Cover;
        public static FieldInfo carton_Cover = new FieldInfo("mdc_Bom_MTO_Fini", "Carton_Cover");


        [Column]
        public string Carton_Cover_Q { get { return _Carton_Cover_Q; } set { _Carton_Cover_Q = value; EntityState.FieldChange("Carton_Cover_Q"); } }
        private string _Carton_Cover_Q;
        public static FieldInfo carton_Cover_Q = new FieldInfo("mdc_Bom_MTO_Fini", "Carton_Cover_Q");

        [Column]
        public string Tagboard { get { return _Tagboard; } set { _Tagboard = value; EntityState.FieldChange("Tagboard"); } }
        private string _Tagboard;
        public static FieldInfo tagboard = new FieldInfo("mdc_Bom_MTO_Fini", "Tagboard");

        [Column]
        public string Tagboard_Q { get { return _Tagboard_Q; } set { _Tagboard_Q = value; EntityState.FieldChange("Tagboard_Q"); } }
        private string _Tagboard_Q;
        public static FieldInfo tagboard_Q = new FieldInfo("mdc_Bom_MTO_Fini", "Tagboard_Q");

        [Column]
        public string Cardfile { get { return _Cardfile; } set { _Cardfile = value; EntityState.FieldChange("Cardfile"); } }
        private string _Cardfile;
        public static FieldInfo cardfile = new FieldInfo("mdc_Bom_MTO_Fini", "Cardfile");

        [Column]
        public string Cardfile_Q { get { return _Cardfile_Q; } set { _Cardfile_Q = value; EntityState.FieldChange("Cardfile_Q"); } }
        private string _Cardfile_Q;
        public static FieldInfo cardfile_Q = new FieldInfo("mdc_Bom_MTO_Fini", "Cardfile_Q");

        [Column]
        public string Ribbon { get { return _Ribbon; } set { _Ribbon = value; EntityState.FieldChange("Ribbon"); } }
        private string _Ribbon;
        public static FieldInfo ribbon = new FieldInfo("mdc_Bom_MTO_Fini", "Ribbon");

        [Column]
        public string Ribbon_Q { get { return _Ribbon_Q; } set { _Ribbon_Q = value; EntityState.FieldChange("Ribbon_Q"); } }
        private string _Ribbon_Q;
        public static FieldInfo ribbon_Q = new FieldInfo("mdc_Bom_MTO_Fini", "Ribbon_Q");

        [Column]
        public string Position_Type_f { get { return _Position_Type_f; } set { _Position_Type_f = value; EntityState.FieldChange("Position_Type_f"); } }
        private string _Position_Type_f;
        public static FieldInfo position_Type_f = new FieldInfo("mdc_Bom_MTO_Fini", "Position_Type_f");

        [Column]
        public string Component_SAPcode { get { return _Component_SAPcode; } set { _Component_SAPcode = value; EntityState.FieldChange("Component_SAPcode"); } }
        private string _Component_SAPcode;
        public static FieldInfo component_SAPcode = new FieldInfo("mdc_Bom_MTO_Fini", "Component_SAPcode");

        [Column]
        public string Quantity 
        { 
            get 
            {
                if (Position_Type_f == "T")
                {
                    _Quantity = "1";
                }
                return _Quantity; }
            set { _Quantity = value; EntityState.FieldChange("Quantity"); } }
        private string _Quantity;
        public static FieldInfo quantity = new FieldInfo("mdc_Bom_MTO_Fini", "Quantity");

        [Column]
        public string Unit_of_measure
        {
            get
            {
                if (Position_Type_f == "L")
                {
                    if ((string.IsNullOrEmpty(Component_SAPcode)))
                    {
                        _Unit_of_measure = "";
                    }
                    else if (Component_SAPcode.Substring(0, 1).ToUpper() == "4" || Component_SAPcode.Substring(0, 1).ToUpper() == "1")
                    {
                        _Unit_of_measure = "KG"; 
                    }
                    else
                    {
                        _Unit_of_measure = "PC";
                    }
                }
                else if (Position_Type_f == "T")
                {
                    _Unit_of_measure = "TXT";
                }

                return _Unit_of_measure; }
            set { _Unit_of_measure = value; EntityState.FieldChange("Unit_of_measure"); }
        }
        private string _Unit_of_measure;
        public static FieldInfo unit_of_measure = new FieldInfo("mdc_Bom_MTO_Fini", "Unit_of_measure");

        [Column]
        public string Relevancy_to_Costing
        { get 
        {
            if (Position_Type_f == "L")
            {
                _Relevancy_to_Costing = "Yes";
            }
            else
            {
                _Relevancy_to_Costing = "No";
            }
            return _Relevancy_to_Costing; }
            set { _Relevancy_to_Costing = value; EntityState.FieldChange("Relevancy_to_Costing"); } }
        private string _Relevancy_to_Costing="Yes";
        public static FieldInfo relevancy_to_Costing = new FieldInfo("mdc_Bom_MTO_Fini", "Relevancy_to_Costing");

        [Column]
        [NowDate]
        public DateTime Time { get { return _Time; } set { _Time = value; EntityState.FieldChange("Time"); } }
        private DateTime _Time;
        public static FieldInfo time = new FieldInfo("mdc_Bom_MTO_Fini", "Time");

        [Column]
        [DefaultInt(0)]
        public int Status { get { return _Status; } set { _Status = value; EntityState.FieldChange("Status"); } }
        private int _Status;
        public static FieldInfo status = new FieldInfo("mdc_Bom_MTO_Fini", "Status");
    }
}
